<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
        <%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
	<script type="text/javascript" language="JavaScript">
	function validate()
	{
		var usernameValue = document.getElementById("usernameId").value;
		var passwordValue = document.getElementById("passwordId").value;
		var repasswordValue = document.getElementById("repasswordId").value;
		
		if (usernameValue.length == 0)
			{
			alert("username required");
			return false;
			}
		
		else if ((usernameValue.length < 6) || usernameValue.length > 12)
		{
			alert("username should be between 6 and 12");
			return false;
		}
		
		if (passwordValue.length==0)
		{
		alert("password required");
		return false;
		}
		
	    else if (passwordValue.length  > 6 || passwordValue.length>12){
		alert("password should be between 6 and 12");
		return false;
	    }
		
		if (repasswordValue.length==0)
		{
		alert("repassword required");
		return false;
		}
	else if (repasswordValue.length > 6 || repasswordValue.length > 20){
		alert("username should be between 6 and 20");
		return false;
	}
		if(passwordValue!=repasswordValue){
			alert("password and repassword should be same");
			return false;
		}
		return true;
	}
	</script>
	</head>
<body>

<s:form action="register" theme="simple" onsubmit="return validate()">
<table align="center" width="40%">
<tr>
<td>
username
</td>
<td>
<s:textfield name="username" label="username" id="usernameId"></s:textfield>
</td>
</tr>
<tr>
<td>
password
</td>
<td>
<s:password name="password" label="password" id="passwordId"></s:password>
</td>
</tr>
<tr>
<td>
repassword
</td>
<td>
<s:password name="repassword" label="repassword" id="repasswordId"></s:password>
</td>
</tr>
<tr>
<td>
<s:submit label="submit"></s:submit>
<s:reset label="reset"></s:reset>
</td>
</tr>
</table>
</s:form>
</body>
</html>